<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Edit extends CI_Controller {
	function __construct()
	{
		parent::__construct();
	}
	public function index(){
		$this->load->model('messagedata_m');
		$this->load->helper('url');
		$query= $this->messagedata_m->msg_SelectById((integer)($_GET['id']));
		foreach ($query->result() as $rs){
			$data['messageid']=$rs->messageid;
			$data['title']=$rs->title;
			$data['username']=$rs->username;
			$data['message']=$rs->message;
			$data['time']=$rs->time;
			$data['readauth']=$rs->readauth;
		}
		if(($_COOKIE['auth']=='3')||(($_COOKIE['tmpuser']==$data['username'])&&($_COOKIE['auth']!='1'))){
			$this->load->view('edit', $data);
		}else{
			echo "<script language='javascript' type='text/javascript'>";
			echo 'alert("非此留言用户或者权限不足!");';
			echo "</script>";
			redirect('?count=0','refresh');
		}
	}

}

